/*
 * RetrieveMetadataXmlRequestHandler.java
 *
 * Created on October 17, 2007, 10:44 AM
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */

package org.adl.registry.website;

import java.io.IOException;
import javax.servlet.ServletContext;
import javax.servlet.http.HttpServletRequest;

/**
 *
 * @author marksj
 */
public class RetrieveMetadataXmlRequest extends RetrieveRequestHandler
{
    
    /** Creates a new instance of RetrieveMetadataXmlRequestHandler */
    public RetrieveMetadataXmlRequest(HttpServletRequest iRequest, ServletContext iContext)
    throws InvalidRequestException
    {
        super();
        
        super.setServletRequest(iRequest);
        super.setServletContext(iContext);
        
        String registry = iRequest.getParameter("registry"); // This parameter value should be the parameter containing the target registry.
        super.setRegistry(registry);
        
        String contentId = iRequest.getParameter("objidentifier"); // This parameter value should be the parameter containing the target content object identifier.
        super.setContentObjectIdentifier(contentId);
        
        String metadataId = iRequest.getParameter("minsidentifier"); // This parameter value should be the parameter containing the target metadata instance identifier.
        super.setMetadataInstanceIdentifier(metadataId);
        
        String rimUrl = PortalUtil.getRimUrl(iContext, registry);
        super.setRimUrl(rimUrl);
        
        String cak = PortalUtil.getClientAccessKey(iContext);
        super.setClientAccessKey(cak);
    }
    
    public String InvokeRequest()
    throws IOException, InvalidRequestException
    {
        String rimResponse = "";
        
        rimResponse = super.sendRetrieveRequest();
        
        return rimResponse;
    }
}
